package com.xianyun.provider;

import com.xianyun.common.service.UserService;
import com.xianyun.rpc.bootstrap.ProviderBootstrap;
import com.xianyun.rpc.model.ServiceRegisterInfo;
import com.xianyun.rpc.registry.LocalRegistry;
import com.xianyun.rpc.server.impl.VertxHttpServer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xianYun
 * @version 1.0
 **/
public class ProviderAPP {
    public static void main(String[] args) {
        //region 原始版本 注册服务
        LocalRegistry.register(UserService.class.getName(),UserServiceImpl.class);
        new VertxHttpServer().doStart(8080);
        //endregion

        //region 使用快速启动类编写启动
        // 要注册的服务
        List<ServiceRegisterInfo<?>> serviceRegisterInfoList = new ArrayList<>();
        ServiceRegisterInfo serviceRegisterInfo = new ServiceRegisterInfo(UserService.class.getName(), UserServiceImpl.class);
        serviceRegisterInfoList.add(serviceRegisterInfo);

        // 服务提供者初始化
        ProviderBootstrap.init(serviceRegisterInfoList);
        //endregion
    }
}
